import {ElMessage, ElMessageBox} from "element-plus"

export const msgSuccess = (msg:string = "成功") => {
    ElMessage({
        showClose: true,
        message: msg,
        type: 'success',
    })
}

export const msgError = (msg:string = "失败") => {
    ElMessage({
        showClose: true,
        message: msg,
        type: 'error',
    })
}

export const confirmModal = (text:string) => {
    return new Promise((resolve, reject) => {
        ElMessageBox.confirm(
            text,
            {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning',
            }
        ).then((res) => {
            resolve(res)
        }).catch((err) => {
            reject(err)
        })
    })

}
